Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
Calling method on primitive string? "string".length why this is possible although string is not an object

Javascript has 7 primitive values as string,number,bigint,boolean,undefined,symbol, null. What I don't understand they are not really objects when we declare them. And their type is not an object. And we can still call methods on strings. How is that possible?

When we create strings(str1 = "aysel" and check typeof is a string then if you check typeof string comes to function. But if I create str2= new String("aysel") Typeof str2 is obj. But we can call str1.length on primitive string too. Although we have never defined as an object on first place.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda